<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>修改</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <style>
        .container-fluid{
            /*margin:10px 20px;*/
            border-right:1px solid #FFF;
            /*border-radius: 5px;*/
        }
        #submit{
            margin-bottom:20px;
        }
    </style>
</head>
<body style="background-image:url(http://public.weirongm.com/DaChongQing//NewsAdmin/images/bg.png);background-position:top center;  background-attachment: fixed;">
<form action="{:U('News/upd')}" enctype="multipart/form-data" method="post">
<div class="container-fluid col-lg-8 col-md-8">
    <div class="row">
        <!--<div class="col-lg-12 col-md-12 col-xs-12">-->
            <!--<h3>新闻咨询添加</h3>-->
        <!--</div>-->
        <div class="col-lg-12 col-md-12 col-xs-12" style="margin-top:20px;">
            <div class="bs-example" data-example-id="basic-forms">
                    <div class="form-group col-lg-12 col-md-12 col-xs-12">
                        <label for="title">标题</label>
                        <input type="text" class="form-control" id="title" name="title" value="{$news_details['title']}" placeholder="输入标题，必须填">
                    </div>
                    <!--<div class="form-group col-lg-12 col-md-12 col-xs-12">-->
                        <!--<label for="jianjie">简介</label>-->
                        <!--<input type="text" class="form-control" id="jianjie" name="details" value="{$news_details['details']}" placeholder="输入简介，必须填">-->
                    <!--</div>-->
                    <div class="form-group col-lg-12 col-md-12 col-xs-12">
                        <label for="biaoqian">标签</label>
                        <input type="text" class="form-control" name="biaoqian" id="biaoqian" value="{$news_details['label']}" placeholder="标签，可多添。用%隔开">
                    </div>


                    <div class="form-group col-lg-12 col-md-12 col-xs-12">
                        <label for="content">内容</label>
                        <textarea id="content" name="content">{$news_content['content']}</textarea>
                    </div>



            </div>
        </div>
    </div>
</div>


<div class="container-fluid col-lg-4 col-md-4">
    <div class="form-group col-lg-12 col-md-12 col-xs-12" style="margin-top:20px;">
        <label for="fenlei">选择资讯分类</label>
        <select name="column"  style="width:100%;height: 40px ;border-radius: 5px" id="fenlei">
            <foreach name="column" item="column">
                <?php
                                        if($column['id'] == $news_details['column']){
                                            echo "<option selected='selected' value=".$column['id']." >".$column['title']."</option>";
                }else{
                echo "<option value=".$column['id']." >".$column['title']."</option>";
                }
                ?>
                <!--<option value="{$column['id']}">{$column['title']}</option>-->
            </foreach>
        </select>
    </div>
    <div class="form-group col-lg-12 col-md-12 col-xs-12">
        <label for="thumb">缩略图</label>
        <img src="{$news_details['thumb']}"><br/>
        <input type="hidden" value="{$news_details['thumb']}" name="thumba">
        <br/>
        <input type="file" class="form-control" name="thumb" id="thumb" value="{$news_details['thumb']}" placeholder="选择图片，只能选择一张">
    </div>
    <div class="form-group col-lg-12 col-md-12 col-xs-12">
        <label>投票</label><br/>
        <?php
                        if(count($news_vote) != 0){
                            echo "<button type='button' class='btn btn-info' id='close' style='width:100%'>关闭投票</button><p></p>";
        echo "<input type='text' class='votename form-control'  name='vote_title' value=".$news_content['votename']."><br/>";
        $nr = '' ;
        echo "<button type='button' id='tp-button' class='btn btn-danger' style='width:100%'>添加投票选项</button><p></p>";
        foreach ($news_vote as $key){
        $nr .= "<p style='margin: 10px 10px;height: 40px;'><input type='text' class='form-control' name='toupiao[]' id='toupiao' style='float:left;width: 70%;margin-right:2%' value=".$key['vote']."><input  style='float:left;width: 20%' class='form-control' type='text' name='support[]' value=".$key['support']."><span style='display:block;line-height:40px;height:40px;'>&nbsp;票</span></p>";
        }
        echo $nr;
        echo " <p id='tp'></p>";
        }else{
        ?>
        <p><button type="button" class="btn btn-danger openvote">开启投票</button><br/><br/>
            <input type="text" class="votename form-control" style="display: none" name="vote_title" placeholder="输入投票标题">
        </p>
        <button type="button" id="tp-button" class="btn btn-danger">添加投票选项</button>
        <p></p>
        <p id="tp"></p><?php


                        }
                        ?>
        <!--<input type="text" class="form-control" name="toupiao[]" id="toupiao" placeholder="投票内容">-->
    </div>
</div>
    <div class="form-group col-lg-12 col-md-12 col-xs-12">
        <input type="hidden" value="{$news_details['id']}" name="id">
        <button type="submit" class="btn btn-danger" id="submit"  style="  margin-bottom: 0 !important;width: 100%;  position: fixed;bottom: 0;left: 0;z-index: 999;">确认修改</button>
    </div>
</form>

<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
    window.UEDITOR_HOME_URL = "/ueditor/";
    window.onload = function () {
        window.UEDITOR_CONFIG.initialFrameWidth = '100%';
        window.UEDITOR_CONFIG.initialFrameHeight = 450;
        UE.getEditor('content');
    }
</script>
<script>
    $(function(){
        $('#tp-button').click(function(){
            var str = '<input type="text" class="form-control" name="toupiao[]" id="toupiao" placeholder="投票内容">';
            $('#tp').before(str);
        })
        $('.openvote').click(function(){
            $('.votename').show();
        })
        $('#close').click(function(){
            $(this).parent().empty();
        })
    })
</script>
</body>
</html>